//
//  KDCover.m
//  QLYuQingPersonal
//
//  Created by 魏强 on 17/5/27.
//  Copyright © 2017年 KDTech. All rights reserved.
//

#import "KDCover.h"

@implementation KDCover
- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
                [self initUI];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self) {
                [self initUI];
    }
    return self;
}
- (void)initUI{
    self.frame = [UIApplication sharedApplication].keyWindow.bounds;
    self.backgroundColor = GBColor(0, 0, 0, 0.5);
}
+ (instancetype)create{
    KDCover *cover = [[KDCover alloc]init];
    [[UIApplication sharedApplication].keyWindow addSubview:cover];
    return cover;
}
-(void)hideAnimation
{
//    if (_delegate && [_delegate respondsToSelector:@selector(coverClick)]) {
//        [_delegate coverClick];
//    }
//    for (UIView *subview in self.subviews) {
//        [subview removeFromSuperview];
//    }
//    //消失动画
//    [UIView animateWithDuration:0.38 animations:^{
//        
//        self.alpha = 0;
//    } completion:^(BOOL finished){
//        
//        [self removeFromSuperview];
//    }];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
